package com.methodknowledgy.gwt.sizzle.client;

import com.google.gwt.core.client.JavaScriptObject;
import com.google.gwt.core.client.JsArray;
import com.google.gwt.dom.client.Document;
import com.google.gwt.dom.client.Element;
import com.google.gwt.dom.client.Node;

public class Sizzle {

    public static native JsArray<Element> matches(String selector,
            JsArray<Element> set) /*-{
        return $wnd.Sizzle.matches(selector, set);
    }-*/;

    public static JsArray<Element> select(String selector) {
        return Sizzle.select(selector, Document.get());
    }

    public static JsArray<Element> select(String selector, Node context) {
        JsArray<Element> results = JavaScriptObject.createArray().cast();
        return Sizzle.select(selector, context, results);
    }

    public static native JsArray<Element> select(String selector, Node context,
            JsArray<Element> results) /*-{
        return $wnd.Sizzle(selector, context, results);
    }-*/;

    private Sizzle() {
    }

}
